//
//  RegisterConfirmView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/2/27.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "RegisterConfirmView.h"
#import <Masonry.h>
@implementation RegisterConfirmView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    
    self.passwordView = [[UIView alloc] init];
    [self addSubview:self.passwordView];
    [self.passwordView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
        make.top.equalTo(self).offset(30);
    }];
    
    self.passwordLab = [[UILabel alloc] init];
    self.passwordLab.text = @"密码";
    self.passwordLab.font = [UIFont systemFontOfSize:16.0f];
    self.passwordLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self.passwordView addSubview:self.passwordLab];
    [self.passwordLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordView);
        make.centerY.equalTo(self.passwordView);
        make.width.mas_equalTo(50);
    }];
    
    self.passwordNumTf = [[UITextField alloc] init];
    self.passwordNumTf.placeholder = @"6~20位数字字母组合";
    self.passwordNumTf.secureTextEntry = YES;
    self.passwordNumTf.font = [UIFont systemFontOfSize:16.0f];
    self.passwordNumTf.textAlignment = NSTextAlignmentLeft;
    self.passwordNumTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.passwordView addSubview:self.passwordNumTf];
    [self.passwordNumTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordLab.mas_right).offset(30);
        make.centerY.equalTo(self.passwordView);
        make.right.equalTo(self.passwordView);
        make.height.equalTo(self.passwordView);
    }];
    
    self.passwordLineView = [[UIView alloc] init];
    self.passwordLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 /255.0 blue:229 / 255.0 alpha:1];
    [self.passwordView addSubview:self.passwordLineView];
    [self.passwordLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.passwordView);
        make.right.equalTo(self.passwordView);
        make.bottom.equalTo(self.passwordView);
        make.height.mas_equalTo(1);
    }];
    
    
    self.rePasswordView = [[UIView alloc] init];
    [self addSubview:self.rePasswordView];
    [self.rePasswordView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
        make.top.equalTo(self.passwordLineView.mas_bottom).offset(10);
    }];
    
    self.rePasswordLab = [[UILabel alloc] init];
    self.rePasswordLab.text = @"确认密码";
    self.rePasswordLab.font = [UIFont systemFontOfSize:16.0f];
    self.rePasswordLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self.rePasswordView addSubview:self.rePasswordLab];
    [self.rePasswordLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.rePasswordView);
        make.centerY.equalTo(self.rePasswordView);
        make.width.mas_equalTo(80);
    }];
    
    self.rePasswordNumTf = [[UITextField alloc] init];
    self.rePasswordNumTf.placeholder = @"再次输入密码";
    self.rePasswordNumTf.secureTextEntry = YES;
    self.rePasswordNumTf.font = [UIFont systemFontOfSize:16.0f];
    self.rePasswordNumTf.textAlignment = NSTextAlignmentLeft;
    self.rePasswordNumTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.rePasswordView addSubview:self.rePasswordNumTf];
    [self.rePasswordNumTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.rePasswordLab.mas_right);
        make.centerY.equalTo(self.rePasswordView);
        make.right.equalTo(self.passwordView);
        make.height.equalTo(self.rePasswordView);
    }];
    
    self.rePasswordLineView = [[UIView alloc] init];
    self.rePasswordLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 /255.0 blue:229 / 255.0 alpha:1];
    [self.rePasswordView addSubview:self.rePasswordLineView];
    [self.rePasswordLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.rePasswordView);
        make.right.equalTo(self.rePasswordView);
        make.bottom.equalTo(self.rePasswordView);
        make.height.mas_equalTo(1);
    }];
    
    
    
    self.inviteCodeView = [[UIView alloc] init];
    [self addSubview:self.inviteCodeView];
    [self.inviteCodeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
        make.top.equalTo(self.rePasswordLineView.mas_bottom).offset(10);
    }];
    
    self.inviteCodeLab = [[UILabel alloc] init];
    self.inviteCodeLab.text = @"邀请码";
    self.inviteCodeLab.font = [UIFont systemFontOfSize:16.0f];
    self.inviteCodeLab.textColor = [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1];
    [self.inviteCodeView addSubview:self.inviteCodeLab];
    [self.inviteCodeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.inviteCodeView);
        make.centerY.equalTo(self.inviteCodeView);
        make.width.mas_equalTo(50);
    }];
    
    self.inviteCodeNumTf = [[UITextField alloc] init];
    self.inviteCodeNumTf.placeholder = @"邀请码(非必填)";
    self.inviteCodeNumTf.font = [UIFont systemFontOfSize:16.0f];
    self.inviteCodeNumTf.textAlignment = NSTextAlignmentLeft;
    self.inviteCodeNumTf.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self.inviteCodeView addSubview:self.inviteCodeNumTf];
    [self.inviteCodeNumTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.inviteCodeLab.mas_right).offset(30);
        make.centerY.equalTo(self.inviteCodeView);
        make.right.equalTo(self.passwordView);
        make.height.equalTo(self.inviteCodeView);
    }];
    
    self.inviteCodeLineView = [[UIView alloc] init];
    self.inviteCodeLineView.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:229 /255.0 blue:229 / 255.0 alpha:1];
    [self.inviteCodeView addSubview:self.inviteCodeLineView];
    [self.inviteCodeLineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.inviteCodeView);
        make.right.equalTo(self.inviteCodeView);
        make.bottom.equalTo(self.inviteCodeView);
        make.height.mas_equalTo(1);
    }];
    
    
    self.radioBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.radioBtn setImage:[UIImage imageNamed:@"btn_radio_normal"] forState:(UIControlStateNormal)];
    [self.radioBtn setImage:[UIImage imageNamed:@"btn_radio_pressed"] forState:(UIControlStateSelected)];
    [self addSubview:self.radioBtn];
    [self.radioBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.inviteCodeLineView);
        make.top.equalTo(self.inviteCodeLineView.mas_bottom).offset(15);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
    
    self.protocolLab = [[UILabel alloc] init];
    self.protocolLab.text = @"同意并已阅读《服务协议》《法律声明及隐私权政策》";
    self.protocolLab.textAlignment = NSTextAlignmentRight;
    self.protocolLab.numberOfLines = 0;
    self.protocolLab.font = [UIFont systemFontOfSize:12.0f];
    self.protocolLab.textColor = [UIColor colorWithRed:49/255.0 green:138/255.0 blue:255/255.0 alpha:1.0];
    [self addSubview:self.protocolLab];
    [self.protocolLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.radioBtn.mas_right).offset(5);
        make.centerY.equalTo(self.radioBtn);
        make.right.mas_equalTo(-15);
    }];
    
    
    self.nextStepBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.nextStepBtn setTitle:@"下一步" forState:(UIControlStateNormal)];
    [self.nextStepBtn setTitleColor:[UIColor whiteColor]forState:(UIControlStateNormal)];
    self.nextStepBtn.titleLabel.font = [UIFont systemFontOfSize:16.0];
    self.nextStepBtn.backgroundColor = [UIColor colorWithRed:219/255.0 green:224/255.0 blue:255/255.0 alpha:1.0];
    self.nextStepBtn.layer.cornerRadius = 22;
    [self addSubview:self.nextStepBtn];
    [self.nextStepBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.radioBtn.mas_bottom).offset(40);
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.height.mas_equalTo(44);
    }];
    
}

@end
